package cn.yunhe.services;

import cn.yunhe.dao.IOrderConDao;
import cn.yunhe.entity.OrderCon;
import cn.yunhe.util.SqlSessionFactoryUtil;
import net.sf.json.JSONArray;
import org.apache.ibatis.session.SqlSession;

import java.util.ArrayList;
import java.util.List;

/**
 * 李非凡
 * 订单详情展示
 */
public class OrderConShowService {
    SqlSession sqlSession = null;
    IOrderConDao iOrderConDaoDao = null;
    /**
     * 商家订单详情展示
     * @param oid
     */
    public JSONArray getOrderCon(String oid) {

        List<OrderCon> orderConList = new ArrayList<>();
        try {
            sqlSession = SqlSessionFactoryUtil.getSqlSession();
            iOrderConDaoDao = sqlSession.getMapper(IOrderConDao.class);
            orderConList = iOrderConDaoDao.getOrderCon(oid);
        } finally {
            sqlSession.close();
        }
        JSONArray jsonArray = new JSONArray();
        jsonArray.addAll(orderConList);
        return jsonArray;
    }
}
